package ab.mes.controller;


import ab.mes.service.OrderCheckService;
import ab.mes.tools.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/orderCheck")
public class OrderCheckController {
    @Autowired
    private OrderCheckService orderCheckService;

    //查詢所有訂單首檢項
    @PostMapping("/selectOrderCheck")
    public Result selectOrderCheck(){
        Result result = new Result();
        try {
            result = orderCheckService.selectOrderCheck();
        }catch (Exception e){
            result.setErrorMessage("查询首检项失败！");
            e.printStackTrace();
        }
        return result;
    }
    //根據生產序號、產品貨號查詢訂單首檢項
    @PostMapping("/selectByNum")
    public Result selectByNum(String num){
        Result result = new Result();
        try {
            result = orderCheckService.selectByNum(num);
        }catch (Exception e){
            result.setErrorMessage("查询首检项失败！");
            e.printStackTrace();
        }
        return result;
    }
}
